package mess;

public class LeeCode_12 {
    public static void main(String[] args) {
        System.out.println(intToRoman(9999));
    }
    private static String intToRoman(int num) {
        String[] singles = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"};
        String[] tens = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"};
        String[] hundreds = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};
        String thousands = "";
        int single = num % 10;
        int ten = num / 10 % 10;
        int hundred = num / 100 % 10;
        int thousand = num / 1000 % 10;
        for (int i = 0; i < thousand; i++)
            thousands += 'M';
        return thousands + hundreds[hundred] + tens[ten] + singles[single];
    }
}
